#include <QtGui/QApplication>
#include "widget.h"
#include "driverjack.h"
#include "engine.h"
#include "database/dbwrapper.h"
#include "database/database.h"
#include "datamidi.h"
#include "datalocator.h"
#include "mixer.h"
#include "fileio/midifile.h"

void test_midifile(){
    MidiFile file;
    QString filename("/home/tim/projects/QTCreator/kachkonome/wmelonman.mid");
    if(!file.import(filename))
        gl::log("SMF: cant open file " + filename);
    gl::log("SMF: format: %1", file.format());
    gl::log("SMF: n_tracks: %1", file.nTracks());
    gl::log("SMF: time_division: %1", file.timeDivision());
    if(file.isTickPerBeat()) gl::log("SMF: time_division in tpb");

}

int main(int argc, char *argv[])
{

    QApplication a(argc, argv);
    test_midifile();
    Widget w;
    w.show();
    return a.exec();
}





void test1() {
    //    DBWrapper dbWrapper;

    //    dbWrapper.add(new DataLocator(0), 9999);
    //    dbWrapper.add(new DataMidi(DataMidi::k_note_on, 20, 100), 10000);
    //    dbWrapper.add(new DataMidi(DataMidi::k_note_on, 1, 100), 10000);
    //    dbWrapper.add(new DataMidi(DataMidi::k_note_on, 1, 100), 20000);
    //    dbWrapper.add(new DataMidi(DataMidi::k_note_on, 10, 100), 30000);
    //    dbWrapper.add(new DataMidi(DataMidi::k_note_on, 20, 100), 40000);
    //    dbWrapper.add(new DataLocator(1), 50000);
    ////    dbWrapper.add(new DataMidi(DataMidi::k_note_on, 1, 100), 60000);


    //    QSharedPointer<Engine> engine (new Engine(dbWrapper));
    //    QSharedPointer<AIDriver> driver (new DriverJack(engine));



    //    driver->startAll();

    //    Widget w;
    //    w.show();

    //    w.connect(&w,SIGNAL(volume(int,float)), engine->mixer(), SLOT(volume(int,float)));
    //    w.connect(&w,SIGNAL(pan(int,float)), engine->mixer(), SLOT(pan(int,float)));
    //    w.connect(&w,SIGNAL(mute(int,bool)), engine->mixer(), SLOT(mute(int,bool)));
}
